from openpyxl import Workbook
wb = Workbook()
ws = wb.active

# 写入测试用例
test_cases = [
    ["TC-001", "零值显示", "HeiLvl=0x0000", "显示'0m'", "PASS"],
    ["TC-002", "正海拔显示", "HeiLvlSign=0, HeiLvl=0x00C8", "显示'200m'", "PASS"],
    ["TC-003", "负值超限", "HeiLvlSign=1, HeiLvl=0x03E8", "锁定最后一次有效值", "FAIL"],
    ["TC-004", "信号丢失", "连续11周期无信号", "保持最后一次有效值", "PASS"]
]

ws.append(["用例ID", "测试项", "输入条件", "预期结果", "实际结果"])
for case in test_cases:
    ws.append(case)

wb.save("模块测试规范.xlsx")